#include<func.h>
//设置线程属性为detached
void* thread_func(void*p)
{
    pthread_exit((void*)3);
}

int main()
{
    pthread_t pthid;
    pthread_attr_t attr;
    int ret=pthread_attr_init(&attr);//初始化线程属性
    ret=pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);//设置线程属性为detached
    pthread_create(&pthid,NULL,thread_func,NULL);
    long thread_return;
    pthread_join(pthid,(void**)&thread_return);
    printf("I am main thread,child thread return=%ld\n",thread_return);
    return 0;
}